<!-- HTML header for doxygen 1.8.10-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.8"/>
<title>NATS C Client with JetStream and Streaming support: Publishing</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="customdoxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;" >
   <div id="projectname">NATS C Client with JetStream and Streaming support
   &#160;<span id="projectnumber">3.10.0-beta</span>
   </div>
   <div id="projectbrief">The nats.io C Client, Supported by Synadia Communications Inc.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.8 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__conn_pub_group.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">Publishing<div class="ingroups"><a class="el" href="group__func_group.html">Functions</a> &raquo; <a class="el" href="group__conn_group.html">Connection</a></div></div></div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gac0b9f7759ecc39b8d77807b94254f9b4" id="r_gac0b9f7759ecc39b8d77807b94254f9b4"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__conn_pub_group.html#gac0b9f7759ecc39b8d77807b94254f9b4">natsConnection_Publish</a> (<a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *nc, const char *subj, const void *data, int dataLen)</td></tr>
<tr class="memdesc:gac0b9f7759ecc39b8d77807b94254f9b4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Publishes data on a subject.  <br /></td></tr>
<tr class="separator:gac0b9f7759ecc39b8d77807b94254f9b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad09a717c20de4cf0e2a21dcfd9ce6c64" id="r_gad09a717c20de4cf0e2a21dcfd9ce6c64"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__conn_pub_group.html#gad09a717c20de4cf0e2a21dcfd9ce6c64">natsConnection_PublishString</a> (<a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *nc, const char *subj, const char *str)</td></tr>
<tr class="memdesc:gad09a717c20de4cf0e2a21dcfd9ce6c64"><td class="mdescLeft">&#160;</td><td class="mdescRight">Publishes a string on a subject.  <br /></td></tr>
<tr class="separator:gad09a717c20de4cf0e2a21dcfd9ce6c64"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga74511acd87385931112c45c48c2a14ba" id="r_ga74511acd87385931112c45c48c2a14ba"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__conn_pub_group.html#ga74511acd87385931112c45c48c2a14ba">natsConnection_PublishMsg</a> (<a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *nc, <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> *msg)</td></tr>
<tr class="memdesc:ga74511acd87385931112c45c48c2a14ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Publishes a message on a subject.  <br /></td></tr>
<tr class="separator:ga74511acd87385931112c45c48c2a14ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaaaa3d75ffec2dcdc6bf905cdb1eee59e" id="r_gaaaa3d75ffec2dcdc6bf905cdb1eee59e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__conn_pub_group.html#gaaaa3d75ffec2dcdc6bf905cdb1eee59e">natsConnection_PublishRequest</a> (<a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *nc, const char *subj, const char *reply, const void *data, int dataLen)</td></tr>
<tr class="memdesc:gaaaa3d75ffec2dcdc6bf905cdb1eee59e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Publishes data on a subject expecting replies on the given reply.  <br /></td></tr>
<tr class="separator:gaaaa3d75ffec2dcdc6bf905cdb1eee59e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaafca9a8294e81a5a9979e762931e56c5" id="r_gaafca9a8294e81a5a9979e762931e56c5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__conn_pub_group.html#gaafca9a8294e81a5a9979e762931e56c5">natsConnection_PublishRequestString</a> (<a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *nc, const char *subj, const char *reply, const char *str)</td></tr>
<tr class="memdesc:gaafca9a8294e81a5a9979e762931e56c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Publishes a string on a subject expecting replies on the given reply.  <br /></td></tr>
<tr class="separator:gaafca9a8294e81a5a9979e762931e56c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaf4b4a022f9c21fc269b87c000330c5a7" id="r_gaf4b4a022f9c21fc269b87c000330c5a7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__conn_pub_group.html#gaf4b4a022f9c21fc269b87c000330c5a7">natsConnection_Request</a> (<a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> **replyMsg, <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *nc, const char *subj, const void *data, int dataLen, int64_t timeout)</td></tr>
<tr class="memdesc:gaf4b4a022f9c21fc269b87c000330c5a7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a request and waits for a reply.  <br /></td></tr>
<tr class="separator:gaf4b4a022f9c21fc269b87c000330c5a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4bb5105df6a3efd2088e6be0fdf6b31f" id="r_ga4bb5105df6a3efd2088e6be0fdf6b31f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__conn_pub_group.html#ga4bb5105df6a3efd2088e6be0fdf6b31f">natsConnection_RequestString</a> (<a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> **replyMsg, <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *nc, const char *subj, const char *str, int64_t timeout)</td></tr>
<tr class="memdesc:ga4bb5105df6a3efd2088e6be0fdf6b31f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a request (as a string) and waits for a reply.  <br /></td></tr>
<tr class="separator:ga4bb5105df6a3efd2088e6be0fdf6b31f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga052de4b75b3b69ccd8d20eb4861b801d" id="r_ga052de4b75b3b69ccd8d20eb4861b801d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__conn_pub_group.html#ga052de4b75b3b69ccd8d20eb4861b801d">natsConnection_RequestMsg</a> (<a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> **replyMsg, <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *nc, <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> *requestMsg, int64_t timeout)</td></tr>
<tr class="memdesc:ga052de4b75b3b69ccd8d20eb4861b801d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a request based on the given <code>requestMsg</code> and waits for a reply.  <br /></td></tr>
<tr class="separator:ga052de4b75b3b69ccd8d20eb4861b801d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>Publishing functions </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="gac0b9f7759ecc39b8d77807b94254f9b4" name="gac0b9f7759ecc39b8d77807b94254f9b4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac0b9f7759ecc39b8d77807b94254f9b4">&#9670;&#160;</a></span>natsConnection_Publish()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsConnection_Publish </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *&#160;</td>
          <td class="paramname"><em>nc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>subj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>dataLen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Publishes the data argument to the given subject. The data argument is left untouched and needs to be correctly interpreted on the receiver.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nc</td><td>the pointer to the <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec" title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
    <tr><td class="paramname">subj</td><td>the subject the data is sent to. </td></tr>
    <tr><td class="paramname">data</td><td>the data to be sent, can be <code>NULL</code>. </td></tr>
    <tr><td class="paramname">dataLen</td><td>the length of the data to be sent. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gad09a717c20de4cf0e2a21dcfd9ce6c64" name="gad09a717c20de4cf0e2a21dcfd9ce6c64"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad09a717c20de4cf0e2a21dcfd9ce6c64">&#9670;&#160;</a></span>natsConnection_PublishString()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsConnection_PublishString </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *&#160;</td>
          <td class="paramname"><em>nc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>subj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convenient function to publish a string. This call is equivalent to:</p>
<div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span>* myString = <span class="stringliteral">&quot;hello&quot;</span>;</div>
<div class="line"> </div>
<div class="line"><a class="code hl_function" href="group__conn_pub_group.html#gac0b9f7759ecc39b8d77807b94254f9b4">natsConnection_Publish</a>(nc, subj, (<span class="keyword">const</span> <span class="keywordtype">void</span>*) myString, (<span class="keywordtype">int</span>) strlen(myString));</div>
<div class="ttc" id="agroup__conn_pub_group_html_gac0b9f7759ecc39b8d77807b94254f9b4"><div class="ttname"><a href="group__conn_pub_group.html#gac0b9f7759ecc39b8d77807b94254f9b4">natsConnection_Publish</a></div><div class="ttdeci">NATS_EXTERN natsStatus natsConnection_Publish(natsConnection *nc, const char *subj, const void *data, int dataLen)</div><div class="ttdoc">Publishes data on a subject.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nc</td><td>the pointer to the <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec" title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
    <tr><td class="paramname">subj</td><td>the subject the data is sent to. </td></tr>
    <tr><td class="paramname">str</td><td>the string to be sent. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga74511acd87385931112c45c48c2a14ba" name="ga74511acd87385931112c45c48c2a14ba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga74511acd87385931112c45c48c2a14ba">&#9670;&#160;</a></span>natsConnection_PublishMsg()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsConnection_PublishMsg </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *&#160;</td>
          <td class="paramname"><em>nc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> *&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Publishes the <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a" title="A structure holding a subject, optional reply and payload.">natsMsg</a>, which includes the subject, an optional reply and optional data.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="group__msg_group.html#ga098e4fec1c5a71c00a0d092fbd6d1a21" title="Creates a natsMsg object.">natsMsg_Create()</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nc</td><td>the pointer to the <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec" title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
    <tr><td class="paramname">msg</td><td>the pointer to the <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a" title="A structure holding a subject, optional reply and payload.">natsMsg</a> object to send. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaaaa3d75ffec2dcdc6bf905cdb1eee59e" name="gaaaa3d75ffec2dcdc6bf905cdb1eee59e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaaaa3d75ffec2dcdc6bf905cdb1eee59e">&#9670;&#160;</a></span>natsConnection_PublishRequest()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsConnection_PublishRequest </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *&#160;</td>
          <td class="paramname"><em>nc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>subj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>reply</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>dataLen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Publishes the data argument to the given subject expecting a response on the reply subject. Use <a class="el" href="group__conn_pub_group.html#gaf4b4a022f9c21fc269b87c000330c5a7" title="Sends a request and waits for a reply.">natsConnection_Request()</a> for automatically waiting for a response inline.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nc</td><td>the pointer to the <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec" title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
    <tr><td class="paramname">subj</td><td>the subject the request is sent to. </td></tr>
    <tr><td class="paramname">reply</td><td>the reply on which resonses are expected. </td></tr>
    <tr><td class="paramname">data</td><td>the data to be sent, can be <code>NULL</code>. </td></tr>
    <tr><td class="paramname">dataLen</td><td>the length of the data to be sent. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaafca9a8294e81a5a9979e762931e56c5" name="gaafca9a8294e81a5a9979e762931e56c5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaafca9a8294e81a5a9979e762931e56c5">&#9670;&#160;</a></span>natsConnection_PublishRequestString()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsConnection_PublishRequestString </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *&#160;</td>
          <td class="paramname"><em>nc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>subj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>reply</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convenient function to publish a request as a string. This call is equivalent to:</p>
<div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span>* myString = <span class="stringliteral">&quot;hello&quot;</span>;</div>
<div class="line"> </div>
<div class="line">natsPublishRequest(nc, subj, reply, (<span class="keyword">const</span> <span class="keywordtype">void</span>*) myString, (<span class="keywordtype">int</span>) strlen(myString));</div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nc</td><td>the pointer to the <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec" title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
    <tr><td class="paramname">subj</td><td>the subject the request is sent to. </td></tr>
    <tr><td class="paramname">reply</td><td>the reply on which resonses are expected. </td></tr>
    <tr><td class="paramname">str</td><td>the string to send. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gaf4b4a022f9c21fc269b87c000330c5a7" name="gaf4b4a022f9c21fc269b87c000330c5a7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaf4b4a022f9c21fc269b87c000330c5a7">&#9670;&#160;</a></span>natsConnection_Request()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsConnection_Request </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> **&#160;</td>
          <td class="paramname"><em>replyMsg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *&#160;</td>
          <td class="paramname"><em>nc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>subj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>dataLen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Sends a request payload and delivers the first response message, or an error, including a timeout if no message was received properly.</p>
<dl class="section warning"><dt>Warning</dt><dd>If connected to a NATS Server v2.2.0+ with no responder running when the request is received, this call will return a <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80aab97324e40ccfe1360080c651c330e62" title="No responders were running when the server received the request.">NATS_NO_RESPONDERS</a> error.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">replyMsg</td><td>the location where to store the pointer to the received <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a" title="A structure holding a subject, optional reply and payload.">natsMsg</a> reply. </td></tr>
    <tr><td class="paramname">nc</td><td>the pointer to the <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec" title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
    <tr><td class="paramname">subj</td><td>the subject the request is sent to. </td></tr>
    <tr><td class="paramname">data</td><td>the data of the request, can be <code>NULL</code>. </td></tr>
    <tr><td class="paramname">dataLen</td><td>the length of the data to send. </td></tr>
    <tr><td class="paramname">timeout</td><td>in milliseconds, before this call returns <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80ab88994c9ea9889ac4d9d656d62f550ed">NATS_TIMEOUT</a> if no response is received in this alloted time. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga4bb5105df6a3efd2088e6be0fdf6b31f" name="ga4bb5105df6a3efd2088e6be0fdf6b31f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4bb5105df6a3efd2088e6be0fdf6b31f">&#9670;&#160;</a></span>natsConnection_RequestString()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsConnection_RequestString </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> **&#160;</td>
          <td class="paramname"><em>replyMsg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *&#160;</td>
          <td class="paramname"><em>nc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>subj</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>str</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Convenient function to send a request as a string. This call is equivalent to:</p>
<div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span>* myString = <span class="stringliteral">&quot;hello&quot;</span>;</div>
<div class="line"> </div>
<div class="line"><a class="code hl_function" href="group__conn_pub_group.html#gaf4b4a022f9c21fc269b87c000330c5a7">natsConnection_Request</a>(replyMsg, nc, subj, (<span class="keyword">const</span> <span class="keywordtype">void</span>*) myString, (<span class="keywordtype">int</span>) strlen(myString));</div>
<div class="ttc" id="agroup__conn_pub_group_html_gaf4b4a022f9c21fc269b87c000330c5a7"><div class="ttname"><a href="group__conn_pub_group.html#gaf4b4a022f9c21fc269b87c000330c5a7">natsConnection_Request</a></div><div class="ttdeci">NATS_EXTERN natsStatus natsConnection_Request(natsMsg **replyMsg, natsConnection *nc, const char *subj, const void *data, int dataLen, int64_t timeout)</div><div class="ttdoc">Sends a request and waits for a reply.</div></div>
</div><!-- fragment --><dl class="section warning"><dt>Warning</dt><dd>See warning about no responders in <a class="el" href="group__conn_pub_group.html#gaf4b4a022f9c21fc269b87c000330c5a7" title="Sends a request and waits for a reply.">natsConnection_Request()</a>.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">replyMsg</td><td>the location where to store the pointer to the received <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a" title="A structure holding a subject, optional reply and payload.">natsMsg</a> reply. </td></tr>
    <tr><td class="paramname">nc</td><td>the pointer to the <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec" title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
    <tr><td class="paramname">subj</td><td>the subject the request is sent to. </td></tr>
    <tr><td class="paramname">str</td><td>the string to send. </td></tr>
    <tr><td class="paramname">timeout</td><td>in milliseconds, before this call returns <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80ab88994c9ea9889ac4d9d656d62f550ed">NATS_TIMEOUT</a> if no response is received in this alloted time. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga052de4b75b3b69ccd8d20eb4861b801d" name="ga052de4b75b3b69ccd8d20eb4861b801d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga052de4b75b3b69ccd8d20eb4861b801d">&#9670;&#160;</a></span>natsConnection_RequestMsg()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="nats_8h.html#a3bc1b3fe7f64083e60c7c3b93f205bad">NATS_EXTERN</a> <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80">natsStatus</a> natsConnection_RequestMsg </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> **&#160;</td>
          <td class="paramname"><em>replyMsg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec">natsConnection</a> *&#160;</td>
          <td class="paramname"><em>nc</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a">natsMsg</a> *&#160;</td>
          <td class="paramname"><em>requestMsg</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Similar to <a class="el" href="group__conn_pub_group.html#gaf4b4a022f9c21fc269b87c000330c5a7" title="Sends a request and waits for a reply.">natsConnection_Request</a> but uses <code>requestMsg</code> to extract subject, and payload to send.</p>
<dl class="section warning"><dt>Warning</dt><dd>See warning about no responders in <a class="el" href="group__conn_pub_group.html#gaf4b4a022f9c21fc269b87c000330c5a7" title="Sends a request and waits for a reply.">natsConnection_Request()</a>.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">replyMsg</td><td>the location where to store the pointer to the received <a class="el" href="group__types_group.html#gadcab54026c4ed78f344ce03ce31bb61a" title="A structure holding a subject, optional reply and payload.">natsMsg</a> reply. </td></tr>
    <tr><td class="paramname">nc</td><td>the pointer to the <a class="el" href="group__types_group.html#gaf88dca0a18efb5c5e994d265a9f04aec" title="A connection to a NATS Server.">natsConnection</a> object. </td></tr>
    <tr><td class="paramname">requestMsg</td><td>the message used for the request. </td></tr>
    <tr><td class="paramname">timeout</td><td>in milliseconds, before this call returns <a class="el" href="status_8h.html#a36c934157b663b7b5fb5d6609c897c80ab88994c9ea9889ac4d9d656d62f550ed">NATS_TIMEOUT</a> if no response is received in this alloted time. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.10-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">NATS.IO Supported By Synadia Communications Inc.
    <a href="http://www.nats.io">
    </a></li>
  </ul>
</div>
</body>
</html>
